'\" te
.\"  Copyright 1989 AT&T
.\" The contents of this file are subject to the terms of the Common Development and Distribution License (the "License").  You may not use this file except in compliance with the License.
.\" You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE or http://www.opensolaris.org/os/licensing.  See the License for the specific language governing permissions and limitations under the License.
.\" When distributing Covered Code, include this CDDL HEADER in each file and include the License file at usr/src/OPENSOLARIS.LICENSE.  If applicable, add the following below this CDDL HEADER, with the fields enclosed by brackets "[]" replaced with your own identifying information: Portions Copyright [yyyy] [name of copyright owner]
.TH MAKEDEV 3C "Dec 29, 1996"
.SH NAME
makedev, major, minor \- manage a device number
.SH SYNOPSIS
.LP
.nf
#include <sys/types.h>
#include <sys/mkdev.h>

\fBdev_t\fR \fBmakedev\fR(\fBmajor_t\fR \fImaj\fR, \fBminor_t\fR \fImin\fR);
.fi

.LP
.nf
\fBmajor_t\fR \fBmajor\fR(\fBdev_t\fR \fIdevice\fR);
.fi

.LP
.nf
\fBminor_t\fR \fBminor\fR(\fBdev_t\fR \fIdevice\fR);
.fi

.SH DESCRIPTION
.sp
.LP
The \fBmakedev()\fR function returns a formatted device number on success and
\fBNODEV\fR on failure.  The \fImaj\fR argument is the major number.  The
\fImin\fR argument is the minor number.  The \fBmakedev()\fR function can be
used to create a device number for input to \fBmknod\fR(2).
.sp
.LP
The \fBmajor()\fR function returns the major number component from
\fIdevice\fR.
.sp
.LP
The \fBminor()\fR function returns the minor number component  from
\fIdevice\fR.
.SH RETURN VALUES
.sp
.LP
Upon successful completion, \fBmakedev()\fR returns a formatted device number.
Otherwise, \fBNODEV\fR is returned and \fBerrno\fR is set to indicate the
error.
.SH ERRORS
.sp
.LP
The \fBmakedev()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
One or both of the arguments \fImaj\fR and \fImin\fR is too large, or the
\fIdevice\fR number created from \fImaj\fR and \fImin\fR is \fBNODEV\fR.
.RE

.sp
.LP
The \fBmajor()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The \fIdevice\fR argument is \fBNODEV\fR, or the major number component of
\fIdevice\fR is too large.
.RE

.sp
.LP
The \fBminor()\fR function will fail if:
.sp
.ne 2
.na
\fB\fBEINVAL\fR\fR
.ad
.RS 10n
The \fIdevice\fR argument is \fBNODEV\fR.
.RE

.SH ATTRIBUTES
.sp
.LP
See \fBattributes\fR(7) for descriptions of the following attributes:
.sp

.sp
.TS
box;
c | c
l | l .
ATTRIBUTE TYPE	ATTRIBUTE VALUE
_
MT-Level	MT-Safe
.TE

.SH SEE ALSO
.sp
.LP
.BR mknod (2),
.BR stat (2),
.BR attributes (7)
